<template>
  <div class="boxall">
    <div class="more" v-if="hasMore" @click="goMore">
      更多
      <i class="el-icon-arrow-right icon-right"></i>
    </div>
    <div class="alltitle">
      {{ title }}
      <el-tooltip
        v-if="itemData.chart_desc_position == 1 && itemData.chart_desc"
        :content="itemData.chart_desc"
        placement="top"
      >
        <i class="el-icon-info"></i>
      </el-tooltip>
    </div>
    <template v-if="itemData.show">
      <slot> </slot>
      <div
        class="boxfoot"
        v-if="itemData.chart_desc_position == 2 && itemData.chart_desc"
      >
        {{ itemData.chart_desc }}
      </div>
    </template>
    <el-skeleton style="margin-top: 30px" v-else :rows="6" animated />
  </div>
</template>

<script>
export default {
  name: "chartCard",
  components: {},
  props: ["title", "itemData"],
  data() {
    return {};
  },
  computed: {
    hasMore() {
      return [
        "2",
        "3",
        "4",
        "25",
        "26",
        "27",
        "28",
        "29",
        "30",
        "31",
        "32",
        "33",
        "35",
      ].includes(this.itemData.custom_chart_id);
    },
  },
  mounted() {},
  methods: {
    goMore() {
      const key = this.itemData.custom_chart_id;
      // [时效履约率，温度履约率，运营总成本]
      if (["2", "3", "4"].includes(key)) {
        this.$router.push({
          path: "/reportform/operatereport",
          query: { key },
        });
      } else if (["29", "30", "31", "32"].includes(key)) {
        this.$router.push({
          path: "/reportform/salesStatement",
          query: { key },
        });
      } else if (key === "33") {
        // 帮助文档
        window.location.href =
          "https://jm9cmb7qeb.feishu.cn/wiki/space/7156125355529469954?ccm_open_type=lark_wiki_spaceLink";
      } else if (key === "35") {
        // 我的消息
        this.$router.push({
          path: "/message/myMessages",
        });
      } else if (key === "25") {
        // 应开票
        this.$router.push({
          path: "/finance/receiptManage?type=2",
        });
      } else if (key === "26") {
        // 备用金
        this.$router.push({
          path: "/material/invoicebook?activeName=0",
        });
      } else if (key === "27") {
        // 待付款
        this.$router.push({
          path: "/finance/paymentManage?type=0",
        });
      } else if (key === "28") {
        // 待收款
        this.$router.push({
          path: "/finance/receivableManage?type=0",
        });
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.more {
  position: absolute;
  top: 13px;
  right: 10px;
  font-size: 12px;
  color: rgb(64, 158, 255);
  cursor: pointer;

  .icon-right {
    line-height: 16px;
    margin-left: -4px;
  }
}

.boxall {
  // width: calc(50% - 30px);
  width: calc(100% - 30px);
  min-height: 360px;
  background: white;
  padding: 0 10px 24px 10px;
  background-size: 100% auto;
  position: relative;
  z-index: 10;
  display: inline-block;
  margin: 0 0 10px 10px;
  overflow: hidden;
  border-radius: 10px;
  transition: 0.1s;
}

.boxall:hover {
  box-shadow: 5px 5px 6px #ecebeb, -5px -5px 6px #f6f6f6;
}
.alltitle {
  font-size: 14px;
  color: #333;
  font-weight: bold;
  // text-align: center;
  padding-left: 3px;
  line-height: 42px;
  border-bottom: solid 1px #f3f3f3;
}

.boxfoot {
  // height: 100px;
  padding: 10px;
  margin-top: 10px;
  box-sizing: border-box;
  font-size: 14px;
  color: #333;
  background-color: #f3f3f3;
  border-radius: 3px;
}

// .boxfoot {
//   position: absolute;
//   bottom: 0;
//   width: 100%;
//   left: 0;
// }

// .boxfoot:before,
// .boxfoot:after {
//   position: absolute;
//   width: 8px;
//   height: 8px;
//   content: "";
//   border-bottom: 2px solid rgb(64, 158, 255);
//   bottom: 0;
// }
</style>